{include file='pub/header'/}
<title>订单列表</title>
</head>

<body class="pos-r">
<nav class="breadcrumb">{$breadNav} <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                       href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <form action="" method="get">
            订单状态：
            <select name="status" class="select-box" style="width: auto;">
                <option value="">--请选择--</option>
                <option value="1">未处理</option>
                <option value="2">已处理</option>
            </select>
            <button type="submit" class="btn btn-primary">查询</button>
        </form>

    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort">
            <thead>
            <tr class="text-c">
                <th width="50">退款id</th>
                <th width="60">订单编号</th>
                <th width="60">退款类型</th>
                <th width="30">支付方式</th>
                <th width="30">订单总金额</th>
                <th width="30">申请退款详情</th>
                <th width="30">已退款总金额</th>
                <th width="60">申请时间</th>
                <th width="60">最后一次修改时间</th>
                <th width="30">退款状态</th>
                <th width="30">退款备注</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach $list as $item}
            <tr class="text-c va-m">
                <td>{$item.id}</td>
                <td>{$item.order_no}</td>
                <td>
                    {if $item.refund_type eq 1}
                        整单
                    {else}
                        商品单退
                    {/if}
                </td>
                <td>{:config('pay_type')[$item.pay_type]}</td>
                <td>{$item.order_money}</td>
                <td>
                    <table class="table table-bordered table-border">
                        {foreach $item.refund_detail as $t}
                            <tr>
                                <td>{$t['name']}</td>
                                <td>{$t['prop_name']}</td>
                                <td>{$t['price']}</td>
                                <td>{$t['num']}</td>
                                <td>{:sprintf('%.2f', $t['num']*$t['price'])}</td>
                            </tr>
                        {/foreach}
                    </table>
                </td>
                <td>{$item.refund_money}</td>
                <td>{$item.create_time}</td>
                <td>{$item.update_time}</td>
                <td>
                    {if $item.status eq 1}
                    未处理
                    {elseif $item.status eq 2}
                    已处理
                    {/if}
                </td>
                <td>
                    {$item.remarks}
                </td>
                <td class="td-manage">
                    {if $item.status neq 2}
                    <a style="text-decoration:none" class="ml-5" onClick="backMoney('{$item.id}', '{$item.refund_type}')"
                       href="javascript:;" title="确认退款">
                        <i class="Hui-iconfont">&#xe623;</i>确认退款
                    </a>
                    {else/}
                        退款已处理
                    {/if}
                    <a style="text-decoration:none" class="ml-5" onClick="backDetail('{$item.id}', '{$item.refund_type}')"
                       href="javascript:;" title="退款详情">
                        <i class="Hui-iconfont">&#xe623;</i>查看退款详情
                    </a>

                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {$render}
    </div>
</div>

{include file='pub/footer'/}
<script type="text/javascript">
    // $('.table-sort').dataTable({
    //     "aaSorting": [[1, "desc"]],//默认第几个排序
    //     "bStateSave": true,//状态保存
        // "aoColumnDefs": [
        //     // {"orderable": false, "aTargets": [8]}// 制定列不参与排序
        // ],
    // });

    /**
     * 退款详情
     */
    function backDetail(id){
        layer_show('退款信息补全', '{:url("backDetail")}?refund_id='+id);
    }

    /**
     * 确认退款
     */
    function backMoney(id, refund_type){
        layer.confirm('确认退款？', function () {
            // layer.msg('维护中。。。');
            // return ;
            // if(refund_type == '1'){
            //     $.post('{:url("backMoney")}', {id:id}, function (res) {
            //         if(res.code == 1){
            //             layer.msg('退款成功');
            //         }else{
            //             layer.msg(res.msg);
            //         }
            //     });
            // }else{
                layer_show('退款信息补全', '{:url("addRefundInfo")}?refund_id='+id);
            // }
        });



    }
</script>
</body>
</html>